package com.gametwo;

import android.os.Bundle;
import android.app.Activity;
import android.content.res.Configuration;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;

public class MainActivity extends Activity {
    // A reference to start game button
    Button btn_startGame;
 
    // Activity reference
    Activity activity;
 
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
 
      // Request application to run in fullscreen mode
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
      WindowManager.LayoutParams.FLAG_FULLSCREEN);
 
      // save this activity's reference
      activity = this;
 
      // set content view to main.xml file
      setContentView(R.layout.activity_main);
 
      // gets button reference than process its click event
      btn_startGame = (Button) findViewById(R.id.btnStartGame);
      btn_startGame.setOnClickListener(new OnClickListener() {
        @Override public void onClick(View v) {
          // initialize and display the game here dont worry if your dont understand
          // below three lines yet, you would later, keep reading :)
          GameView mGameView = new GameView(activity);
          setContentView(mGameView);
    mGameView.mThread.doStart();
        }
      });
    }
 
    @Override
    public void onConfigurationChanged(Configuration newConfig) {
      // ignore orientation/keyboard changes
      super.onConfigurationChanged(newConfig);
    }
}
